/*
 * @Author: silence
 * @Date: 2022-02-07 16:47:53
 * @LastEditors: silence
 * @LastEditTime: 2022-04-26 16:00:04
 * @Description: 工具类
 * @FilePath: /flutter_template_app/lib/utils/tools/MyTools.dart
 */

import 'dart:math';

class MyTools {
  /**
   * @description: 判断字符串是否为空
   * @param {*}
   * @return {*}
   */
  static bool stringIsEmpty(dynamic str) {
    if (str == null) {
      return true;
    }

    if (!(str is String)) {
      return true;
    }

    if (str.length < 1) {
      return true;
    }

    return false;
  }

  /**
   * @description: 判断list是否为空
   * @param {*}
   * @return {*}
   */
  static bool listIsEmpty(dynamic list) {
    if (list == null) {
      return true;
    }

    if (!(list is List)) {
      return true;
    }

    if (list.length < 1) {
      return true;
    }

    return false;
  }

  /**
   * @description: 判断map是否为空
   * @param {*}
   * @return {*}
   */
  static bool mapIsEmpty(dynamic map) {
    if (map == null) {
      return true;
    }

    if (!(map is Map)) {
      return true;
    }

    if (map.length < 1) {
      return true;
    }

    return false;
  }

  static double getRandom() {
    return (Random().nextInt(31) + 60).toDouble();
  }
}
